package com.thejoyrun.retrofit.http;

import okhttp3.OkHttpClient;

/**
 * Created by kkmike999 on 2016/05/08.
 */
public class MockRetrofit extends BaseRetrofit {

	MockServerInterceptor mockServerInterceptor = new MockServerInterceptor();

	@Override
	protected String getBaseUrl() {
		return "http://www.***.com"; // 应付retrofit http格式验证
	}

	@Override
	protected OkHttpClient.Builder getOkHttpBuilder() {
		return super.getOkHttpBuilder().addInterceptor(mockServerInterceptor);
	}

	/**
	 * @param url
	 * @param localPath 在assets目录下的相对路径
	 */
	public void setPath(String url, String localPath) {
		mockServerInterceptor.setPath(url, localPath);
	}

	/**
	 * 对url配置成功json返回
	 */
	public void setSuccess(String url) {
		setPath(url, "success.json");
	}
}
